package com.chinasofti.zbest.dao;


import com.chinasofti.zbest.dao.model.Product;
import com.chinasofti.zbest.dao.model.ShopCart;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 购物车 Mapper 接口
 * </p>
 *
 * @author zbest
 * @since 2019-05-28
 */
public interface ShopCartMapper extends BaseMapper<ShopCart> {
    List<ShopCart> queryByUserId(int userId);
    Product queryByProNum(String productNum);
    ShopCart queryForModify(String productNumber);
    void addToCart(ShopCart shopCart);
    void delBy(@Param("userId") Integer userId,
               @Param("productNumber") String productNumber);

    void reduceProductCount(@Param("productNumber") String productNumber,
                            @Param("productCount") Integer productCount,
                            @Param("countPrice") Double countPrice);

    ShopCart queryByShopCartId(@Param("shopCartId")Integer shopCartId);
}
